<template>
  <van-nav-bar
    left-arrow
    :title="title"
    :right-text="rightText"
    @click-left="onClickLeft"
    @click-right="onClickRight"
  />
</template>

<script>
//引用$router和$route
import { useRouter } from "vue-router";
export default {
  setup() {
    // 创建路由信息实例
    const router = useRouter();
    // const route = useRoute();
    const onClickLeft = () => {
      router.push("/index");
    };
    const onClickRight = () => {
      console.log(1);
    };
    return {
      onClickLeft,
      onClickRight,
    };
  },
  props: ["title", "rightText"],
};
</script>

<style lang="less">
.van-nav-bar {
  height: 44px;
  .van-nav-bar__text {
    color: #b5b5b5;
  }
}
</style>
